package Day06;
import java.util.Scanner;
import java.util.Arrays;
public class MethodDemo {
    public static void main(String[] args) {
//        sayHi("xuXinZe");
//        sayHi("goodMorning");
//        sayHello("zhangSan",18);
//        sayHello("liSi",99);
//        textPerson();
//        String name = name1();
//        System.out.println(name);
//        int m = (int)(Math.random()*100)+1;
//        int n = (int)(Math.random()*100)+1;
//        int sum = add1(m,n);
//        System.out.println(m+"+"+n+"="+sum);

        aMethod();


//        int[] a1 = testArray1(8,100);
//        System.out.println("第一个元素为："+a1[1]);
//        int[] a2 = testArray1(10,100);
//        System.out.println("数组a2的长度为："+a2.length);
//        int[] a3 = testArray1(5,100);
//        for (int i=0;i<a3.length;i++) {
//            System.out.print(a3[i]+"\t");
//        }
//        System.out.println();
//        System.out.println(Arrays.toString(a3));

    }
    public static void say (String name) {
        System.out.println("大家好，我叫:"+name);
        System.out.println();
    }
    public static void who (String name) {
        System.out.println("who are you?");
        System.out.println(name);
    }
    public static void sayHi (String name) {
        System.out.println("大家好，我的名字是："+name+"！");
    }
    public static void sayHello (String name,int age) {
        if (age>100) {
            return;
        }
        System.out.println("大家好，我的名字是："+name+",我今年"+age+"岁了！");
    }
    public static void textPerson () {
        Scanner input1 = new Scanner(System.in);
        System.out.print("请录入信息，你的名字：");
        String name = input1.nextLine();
        System.out.print("你的年龄：");
        int age = input1.nextInt();
        System.out.println();
        System.out.println("录入完成！");
        System.out.println("姓名："+name+",年龄："+age);
    }
    public static String name1 () {
        Scanner input1 = new Scanner(System.in);
        String a = input1.nextLine();
        return a;                     //----------------返回的不是变量，而是变量里边的值。
    }
    public static int add1 (int num1,int num2) {
        int sum = num1 + num2;
        return sum;
    }
    public static int[] testArray1 (int _length,int _max) {
        int[] a = new int[_length];
        for (int i=0;i<a.length;i++) {
            a[i] = (int)(Math.random()*(_max+1));
        }
        return a;
    }
    public static void aMethod () {
        System.out.println(111);
        bMethod();
        System.out.println(222);
    }
    public static void bMethod () {
        System.out.println(333);
    }
}
